﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using service;

namespace Trathat
{
    public partial class index : System.Web.UI.Page
    {
        BaivietService serviceBaiviet = new BaivietService();
        protected void Page_Load(object sender, EventArgs e)
        {
            listBaiviet.DataSource = serviceBaiviet.getBaivietTop1ByLoai();
            listBaiviet.DataBind();
        }

        protected void listBaiviet_dataBound(object sender, DataListItemEventArgs e)
        {
            DataList a = (DataList)e.Item.FindControl("listBaivietKhac");
            BindGrid(a, listBaiviet.DataKeys[e.Item.ItemIndex].ToString());
        }

        private void BindGrid(DataList a, string p)
        {
            a.DataSource = serviceBaiviet.getBaivietTop3ByLoai(Convert.ToInt64(p));
            a.DataBind();

        }
    }
}